//
//  RemindSettingVC.m
//  ProjectforHDX
//
//  Created by Jaesun on 16/11/21.
//  Copyright © 2016年 H.DX. All rights reserved.
//

#import "RemindSettingVC.h"
#import "RemindCell.h"

@interface RemindSettingVC ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic, strong) UITableView *tableView;

@end

static NSString *ID_RemindCell = @"remindCell";

@implementation RemindSettingVC

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navColor = SYSTEM_COLOR;
    self.labnav.textColor = [UIColor whiteColor];
    self.labnav.text = [UtilCheck language:@"setting.remind"];
    
    [self setupViews];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];

}




- (void)setupViews {
    
    self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 64, SCREEN_WIDTH, SCREEN_HEIGHT - 64) style:(UITableViewStyleGrouped)];
    self.tableView.dataSource = self;
    self.tableView.delegate = self;
    [self.tableView registerClass:[RemindCell class] forCellReuseIdentifier:ID_RemindCell];
    self.view = self.tableView;
    
}


- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 2;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    RemindCell *cell = [[RemindCell alloc] initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:ID_RemindCell];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    switch (indexPath.row) {
        case 0: {
            cell.titleLabel.text = @"铃声";
            
            [cell.rightSwitch addTarget:self action:@selector(switchAction1:) forControlEvents:(UIControlEventValueChanged)];
           
        }
            break;
        case 1: {
            cell.titleLabel.text = @"震动";
            [cell.rightSwitch addTarget:self action:@selector(switchAction2:) forControlEvents:(UIControlEventValueChanged)];
        }
            break;
        default:
            break;
    }
    
    
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
    return 0.01f;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    return 0.01f;
}

- (void)switchAction1:(UISwitch *)sender {
    
    if (sender.on) {
        
    }
    else {
        sender.tintColor = [UtilCheck hexStringToColor:@"EBEBEB" alpha:1];
    }
}

- (void)switchAction2:(UISwitch *)sender {
    
    if (sender.on) {
        sender.tintColor = [UIColor greenColor];
        
    }
    else {
        sender.tintColor = [UtilCheck hexStringToColor:@"EBEBEB" alpha:1];
    }
}


@end
